<template>
  <div>
    <p>国内网站的粉丝数量：{{ num | initNum(-4) }} 万</p>
    <p>国外网站的粉丝数量：{{ num |initNum(-3)}} 千</p>
    <p>{{ num1 | initTime('-')}}</p>
    <p>{{ num1 | initTime('/')}}</p>
  </div>
</template>

<script>
export default {
  data () {
    return {
      num: 1879999,
      num1: 1636450540055
    }
  },

  created () {

  },
  filters: {
    initNum (val, str) {
      const arr = val.toString().split('')
      arr.splice(str, 0, '.')
      return arr.join('')
    },
    initTime (val, str) {
      // const y = val / 1000 / 60 / 60 / 24
      const date = new Date(val)
      const y = date.getFullYear()
      const m = date.getMonth() + 1
      const d = date.getDate() + 1
      return `${y} ${str} ${m} ${str} ${d}`
    }
  },
  methods: {

  }
}
</script>

<style scoped lang='less'>

</style>
